﻿@using dcp.Routing.Models
@model dynamic

@{
    var items = (IEnumerable<RedirectRule>)Model.Items;
}
@using (Html.BeginFormAntiForgeryPost())
{
    <fieldset class="bulk-actions">
        <label><input type="checkbox" class="check-all" />@T("Select all")</label>@T(" | ")
        <label for="publishActions">@T("Actions:")</label>
        <select id="publishActions" name="BulkAction">
            @Html.SelectOption("None", "None", T("Choose action...").ToString())
            @Html.SelectOption("None", "Move", T("Move to web.config").ToString())
        </select>
        <button type="submit" name="submit.BulkEdit" value="yes">@T("Apply")</button>
    </fieldset>
    <fieldset class="contentItems bulk-items">
        <table class="items" summary="@T("Redirect rules table")">
            <thead>
                <tr>
                    <th>&nbsp;</th>
                    <th>@T("Date")</th>
                    <th>@T("Source URL")</th>
                    <th>@T("Destination URL")</th>
                    <th>@T("Permanent")</th>
                    <th>@T("Actions")</th>
                </tr>
            </thead>
            @foreach (var redirectRule in items)
            {

                <tr>
                    <td><input type="checkbox" value="@redirectRule.Id" name="itemIds" /></td>
                    <td>@redirectRule.CreatedDateTime.ToString("yyyy-MM-dd hh:mm")</td>
                    <td>@redirectRule.SourceUrl</td>
                    <td>@redirectRule.DestinationUrl</td>
                    <td>@redirectRule.IsPermanent</td>
                    <td>
                        @Html.ActionLink(T("Edit").Text, "Edit", "RedirectRule", new { id = redirectRule.Id }, null) |
                        @Html.ActionLink(T("Delete").Text, "Delete", "RedirectRule", new { id = redirectRule.Id }, new { itemprop = "RemoveUrl UnsafeUrl" })
                    </td>
                </tr>
            }
        </table>
    </fieldset>
}

@if (((IDictionary<string, object>) Model).ContainsKey("SomeMember"))
{
    @Display(Model.PagerShape)
}

@Html.AntiForgeryTokenOrchard()
